package com.example.student.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.common.domain.pojo.CourseOutline;
import com.example.student.mapper.CourseOutlineMapper;
import com.example.student.service.CourseOutlineService;
import org.springframework.stereotype.Service;

@Service
public class CourseOutlineServiceImpl extends ServiceImpl<CourseOutlineMapper, CourseOutline> implements CourseOutlineService {

    @Override
    public CourseOutline teacherGetChapter(String courseId) {
        return super.baseMapper.selectById(courseId);
    }

    @Override
    public CourseOutline teacherChangeChapter(CourseOutline courseOutline) {
        boolean success = super.updateById(courseOutline);
        if (success) {
            return super.getById(courseOutline.getCourseId());
        }
        return null;
    }

    @Override
    public void deleteCourseOutline(String courseId) {
        super.baseMapper.deleteById(courseId);
    }

    @Override
    public void saveOutline(CourseOutline courseOutline) {
        super.save(courseOutline);
    }
}
